﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABELGX
{
    public class RegisterBool : Register<bool>, INotifyPropertyChanged
    {
        public CustomizeSet Set { get; protected set; }
        public bool Visiable => Set != null && Set.Visiable;
        public string Text => (Set!=null && Value) ? Set.TextOn : Set.TextOff;
        public string Color=> (Set != null && Value) ? Set.ColorOn : Set.ColorOff;
        public override bool Value
        {
            get => value;
            set
            {
                if (this.value == value)
                {
                    return;
                }
                this.value = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Value"));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Text"));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Color"));
            }
        }
        public RegisterBool():this(false)
        {
            
        }

        public RegisterBool(bool value) : this("开启", "关闭", value)
        {
            
        }
        public RegisterBool(string textOn, string textOff, bool value) : base(value)
        {
            Set = new CustomizeSet(0, true, "", textOn, textOff);
        }
        public RegisterBool(CustomizeSet set, bool value) : base(value)
        {
            Set = set;
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
